/***************************************************************************
 *   Copyleft 2008-2009 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __VTXTINPUTSTREAM_H__
#define __VTXTINPUTSTREAM_H__

#include "./vInputStream.h"
#include "../../Macros/vMemoryMacros.h"
#include <iostream>
#include <fstream>

namespace Vendetta {
	/*! \class vTxtInputStream
	 *   \brief A vTxtInputStream abstract class manages loading data custom text files.
	 *
	 */
	class vTxtInputStream: public vInputStream {
	public:
		/*! \brief Default constructor.
		 *
		 */	
		vTxtInputStream();

		/*! \brief Destructor.
		 *
		 */	
		virtual ~vTxtInputStream();

		/*! \brief Loads data from .ini, .properties file. Implemented from vInputStream.
		 *
		 *	Calls init to prepare data for saving on hard drive. All data operations after
		 *	loading file should be made in postLoad method.
		 *			 
		 *  \param		fileName		File name in which data should be serialized.
		 *	\return						True if data was successfully saved, false otherwise.
		 *	\exception	vException		Thrown when file does no exist or can't read from it.
		 *	\sa	vTxtInputStream::postLoad.
		 *	\sa vInputStream.
		 */
		virtual vBool LoadFromFile(const vString& fileName);

	protected:
		/*! \brief Pure virtual method. Is called after each line is read.
		 *
		 */
		virtual vBool postLineLoad(const vString& line) = 0;
	};
}

#endif // __VTXTINPUTSTREAM_H__